<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>高校列表</title>
  <link href="{{ url_for('static',filename='layui/css/layui.css') }}" rel="stylesheet">
</head>
<body>
<table id="tb_info" class="layui-table"></table>
<script type="text/javascript" src="{{ url_for('static',filename='jquery/jquery-3.5.1.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static',filename='layui/layui.js') }}"></script>
<script type="text/html" id="toolbar">
<div class="layui-container">
    <a href="articleAdd" class="layui-btn layui-btn-danger"><span class="layui-icon layui-icon-addition"></span> 添加</a>
    <a href="#" class="layui-btn layui-btn-warm"><span class="layui-icon layui-icon-delete"></span> 删除</a>
    <div class="layui-input-inline">
    <input type="text" placeholder="请输入文章名称。。。" class="layui-input">
    </div>
    <a href="" class="layui-btn layui-btn-primary"><span class="layui-icon layui-icon-search"></span> 查询</a>
</div>

</script>
<script>
    layui.use(["table"], function () {
        var table = layui.table;
        var t=table.render({
            elem: "#tb_info",
            url: "/backstage/findArticleList",
            toolbar:"#toolbar",
            autoSort:true,
            limit:5,
            limits:[5,10,15,20,100],
            page:true,
            title: "大学排名信息列表",
            cols: [[
                {checkbox: true,width:100},
                {field: "id", title: "Id",align:"center",width:100},
                {field: "title", title: "文章标题",align:"center"},
                {field: "describe", title: "文章简介",align:"center"},
                {field: "creation_time", title: "创建时间",align:"center"},
                {field: "type", title: "文章分类",align:"center"},
                {field: "id", title: "操作",templet:function (d){
                    //layer.msg(d.univNameCn)
                    var str="<a href='javascript:deleteUnivById(\""+d.id+"\")'  title='删除' onclick='return confirm(\"是否真的要删除？\")'><span class='layui-icon layui-icon-delete'></span></a>"
                    var str1="<a href='javascript:deleteUnivById(\""+d.id+"\")'  title='修改' ><span class='layui-icon layui-icon-edit'></span></a>"
                    var str2="<a href='/blog/blogpage/\""+d.id+"\"'  title='查看' ><span class='layui-icon layui-icon-read'></span></a>"
                    return str+str1+str2
                    }
                }
            ]]
        });

    });
function deleteUnivById(id){
        alert(id)
        $.ajax({
            url:"/backstage/deleteUnivById",
            data:{"id":id},
            method:"post",
            success:function (result){
                if(result=="1"){
                    t.reload()
                    layer.msg("删除成功")}
                else
                    layer.msg("删除失败")
            }
        });
    }

</script>
</body>
</html>